package producer.message;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;

/**
 * @author jack
 * @data 2020/6/15 3:05 下午
 */
@RestController
@EnableBinding(SinkSender.class)
public class SendController {
    @Autowired
    private SinkSender sinkSender;

    @RequestMapping("sendArea")
    public String sendArea() {
        sinkSender.outputArea().send(MessageBuilder.withPayload(LocalDate.now().toString()).build());
        return "发送成功";
    }

    @RequestMapping("sendListArea")
    public String sendListArea() {
        sinkSender.outputListArea().send(MessageBuilder.withPayload(LocalDate.now().toString()).build());
        return "发送成功";
    }

}
